package com.kun.entity;

import java.io.Serializable;
import java.util.Date;

import com.alibaba.fastjson.annotation.JSONField;

@SuppressWarnings("serial")
public class Book implements Serializable{
    private Integer bookid;

    private Integer typeid;

    private String booknumber;

    private String bookname;

    private String bookauthor;

    private String bookpress;

    private String bookpicture;

    private Integer bookamount;

    @JSONField(format="yyyy-MM-dd")
    private Date bookshelvetime;

    private String bookremark;

    private Integer bookborrow;
    
    private String bookowner;
    
    private String isShow;
    
    private Type type;

    
    public String getTypeName(){
    	if(type!=null){
    		return type.getTypename();
    	}else{
    		return null;
    	}
    	
    }
    
    public String getBookowner() {
		return bookowner;
	}

	public void setBookowner(String bookowner) {
		this.bookowner = bookowner;
	}



	public Type getType() {
		return type;
	}

	public void setType(Type type) {
		this.type = type;
	}

	public Integer getBookid() {
        return bookid;
    }

    public void setBookid(Integer bookid) {
        this.bookid = bookid;
    }

    public Integer getTypeid() {
        return typeid;
    }

    public void setTypeid(Integer typeid) {
        this.typeid = typeid;
    }

    public String getBooknumber() {
        return booknumber;
    }

    public void setBooknumber(String booknumber) {
        this.booknumber = booknumber == null ? null : booknumber.trim();
    }

    public String getBookname() {
        return bookname;
    }

    public void setBookname(String bookname) {
        this.bookname = bookname == null ? null : bookname.trim();
    }

    public String getBookauthor() {
        return bookauthor;
    }

    public void setBookauthor(String bookauthor) {
        this.bookauthor = bookauthor == null ? null : bookauthor.trim();
    }

    public String getBookpress() {
        return bookpress;
    }

    public void setBookpress(String bookpress) {
        this.bookpress = bookpress == null ? null : bookpress.trim();
    }

    public String getBookpicture() {
        return bookpicture;
    }

    public void setBookpicture(String bookpicture) {
        this.bookpicture = bookpicture == null ? null : bookpicture.trim();
    }

    public Integer getBookamount() {
        return bookamount;
    }

    public void setBookamount(Integer bookamount) {
        this.bookamount = bookamount;
    }

    public Date getBookshelvetime() {
        return bookshelvetime;
    }

    public void setBookshelvetime(Date bookshelvetime) {
        this.bookshelvetime = bookshelvetime;
    }

    public String getBookremark() {
        return bookremark;
    }

    public void setBookremark(String bookremark) {
        this.bookremark = bookremark == null ? null : bookremark.trim();
    }

    public Integer getBookborrow() {
        return bookborrow;
    }

    public void setBookborrow(Integer bookborrow) {
        this.bookborrow = bookborrow;
    }

    public String getIsShow() {
		return isShow;
	}

	public void setIsShow(String isShow) {
		this.isShow = isShow;
	}

	@Override
	public int hashCode() {
		return this.bookid.hashCode();
	}
    
	//使用set排重
	@Override
	public boolean equals(Object obj) {
		 if (!(obj instanceof Book)) {
             return false;
         }
		 Book book = (Book) obj;
         if (book.getBookid() == null) {
             return false;
         }
         return this.bookid.equals(book.getBookid());
	}
    
    
	@Override
	public String toString() {
		return "{bookid=" + bookid + ", typeid=" + typeid + ", booknumber=" + booknumber + ", bookname=" + bookname
				+ ", bookauthor=" + bookauthor + ", bookpress=" + bookpress + ", bookpicture=" + bookpicture
				+ ", bookamount=" + bookamount + ", bookshelvetime=" + bookshelvetime + ", bookremark=" + bookremark
				+ ", bookborrow=" + bookborrow + ", type=" + type + "}";
	}

	
}